package cn.zptc.springbootdemo.mapper;

import cn.zptc.springbootdemo.domain.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CommentMapper {

    @Select("select * from t_comment where id = #{id}")
    public Comment selectById(Integer id);

    //添加评论
    @Insert("INSERT INTO t_comment(content,author,a_id) " +
            "values (#{content},#{author},#{aId})")
    public int insertComment(Comment comment);

    //修改评论
    @Update("update t_comment set content = #{content} where id = #{id}")
    public int updateComment(Comment comment);
}
